package com.abdu.demo.app_ui.fragment;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

public class MyPagerAdapter extends FragmentPagerAdapter {

    public MyPagerAdapter(FragmentManager fragmentManager) {
        super(fragmentManager);
    }

    @Override
    public Fragment getItem(int position) {
        // 根据position返回对应的Fragment
        if (position == 0) {
            return new HomeFragment();
        } else if (position == 1){
            return new FunFragment();
        } else {
            return new UserFragment();
        }
    }

    @Override
    public int getCount() {
        // 返回Fragment的数量
        return 3;
    }
}